home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / v cisle / sadanastroju / wot-20080519-fx.xpi / chrome / wot.jar / content / firstrun.js < prev    next >
Text File  |  2008-03-20  |  2KB  |  81 lines

  1. /*
  2.     firstrun.js
  3.  
  4.     Copyright ⌐ 2007  Against Intuition, Inc. <info@mywot.com>
  5. */
  6.  
  7. const WOT_REGISTER_EULA_ASKED = "wot_register_eula_asked";
  8.  
  9. var wot_firstrun = {
  10.  
  11.     init: function() {
  12.         try {
  13.             window.addEventListener("load", function(e) {
  14.                     wot_firstrun.load();
  15.                 }, false);
  16.         } catch (e) {
  17.             dump("wot_firstrun.init: failed with " + e + "\n");
  18.         }
  19.     },
  20.  
  21.     show_eula: function()
  22.     {
  23.         try {
  24.             if (wot_prefs.eula_accepted ||
  25.                     wot_hashtable.get(WOT_REGISTER_EULA_ASKED)) {
  26.                 return;
  27.             }
  28.  
  29.             wot_hashtable.set(WOT_REGISTER_EULA_ASKED, 1);
  30.  
  31.             window.setTimeout(function() {
  32.                     window.openDialog("chrome://wot/content/eula.xul",
  33.                         "EULA", "chrome,titlebar,centerscreen,modal", null);
  34.  
  35.                     if (!wot_prefs.eula_accepted) {
  36.                         wot_status.set("error",
  37.                             wot_util.getstring("description_uninstall"));
  38.                     }
  39.  
  40.                     wot_core.update();
  41.                 }, 500);
  42.         } catch (e) {
  43.             dump("wot_firstrun.show_eula: failed with " + e + "\n");
  44.         }
  45.     },
  46.  
  47.     open_guide: function()
  48.     {
  49.         try {
  50.             if (Number(wot_prefs.firstrun_guide) >= WOT_FIRSTRUN_GUIDE) {
  51.                 return;
  52.             }
  53.  
  54.             if (!wot_prefs.setChar("firstrun_guide",
  55.                     WOT_FIRSTRUN_GUIDE.toString())) {
  56.                 return;
  57.             }
  58.  
  59.             window.setTimeout(function() {
  60.                     var browser = getBrowser();
  61.                     if (browser) {
  62.                         browser.selectedTab = browser.addTab(WOT_FIRSTRUN_URL);
  63.                     }
  64.                 }, 500);
  65.         } catch (e) {
  66.             dump("wot_firstrun.open_guide: failed with " + e + "\n");
  67.         }
  68.     },
  69.  
  70.     load: function() {
  71.         try {
  72.             this.show_eula();
  73.             this.open_guide();
  74.         } catch (e) {
  75.             dump("wot_firstrun.load: failed with " + e + "\n");
  76.         }
  77.     }
  78. };
  79.  
  80. wot_firstrun.init();
  81.